package com.whu.assignment8.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.util.List;

@Data
@NoArgsConstructor
@Getter
@Setter
@TableName("user")
public class User {

    @TableId
    Integer id;

    String name;

    private String password;

    /**
     * 用户的角色列表
     */
    @TableField(exist = false)
    @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
    private List<Role> roles = new java.util.ArrayList<>();


}
